<template>
  <div class="contentModel" :style="defaultHeight">
    <div class="title">
      <span class="name">{{ name }}</span>

      <div class="btn">
        <ButCom></ButCom>
       
      </div>
    </div>
    <div class="centent">
      <div class="left">
        <Left></Left>
      </div>
      <div class="item">
        <router-view />
      </div>
      <div class="right">
        <Right></Right>
      </div>
    </div>
  </div>
</template>

<script>
import Left from "./components/left.vue";
import Right from "./components/right.vue";
import ButCom from "../../components/btnCom.vue";
export default {
  name: "contentModel",
  components: {
    Left,
    Right,
    ButCom,
  },
  data() {
    return {
      name: "内容模型",
      defaultHeight: {
        height: "",
      },
    };
  },

  methods: {
    //定义方法，获取高度减去头尾
    getHeight() {
      this.defaultHeight.height = window.innerHeight - 100 + "px !important";
    },
  },

  created() {
    //页面创建时执行一次getHeight进行赋值，顺道绑定resize事件
    window.addEventListener("resize", this.getHeight);
    this.getHeight();
  },
};
</script>

<style lang="less" scoped>
.contentModel {
  width: 100%;
  background-color: #f0f2f5;
}
.title {
  display: flex;
  justify-content: space-between !important;
  padding: 30px;
  background-color: #fff;
  .name {
    font-size: 28px;
    font-weight: 800;
  }

  .btn {
    display: flex;
  }
}
.centent {
  display: flex;
  justify-content: space-between;
  margin: 20px 20px 0 20px;
  .left {
    width: 260px;
    height: 485px;
    background-color: #fff;
  }
  .item {
    flex: 1;
    height: 500px;
    margin: 0 20px;
  }
  .right {
    width: 240px;
    height: 500px;
  }
}
</style>
